home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / SCRIB1.PAK / SCRIBDOC.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  3KB  |  100 lines

  1. // ScribDoc.h : interface of the CScribbleDoc class
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1995 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12. /////////////////////////////////////////////////////////////////////////////
  13.  
  14. // Forward declaration of data structure class
  15. class CStroke;
  16.  
  17. class CScribbleDoc : public CDocument
  18. {
  19. protected: // create from serialization only
  20.     CScribbleDoc();
  21.     DECLARE_DYNCREATE(CScribbleDoc)
  22.  
  23. // Attributes
  24. protected:
  25.     // The document keeps track of the current pen width on
  26.     // behalf of all views. We'd like the user interface of
  27.     // Scribble to be such that if the user chooses the Draw
  28.     // Thick Line command, it will apply to all views, not just
  29.     // the view that currently has the focus.
  30.  
  31.     UINT            m_nPenWidth;        // current user-selected pen width
  32.     CPen            m_penCur;           // pen created according to
  33.                                         // user-selected pen style (width)
  34. public:
  35.     CTypedPtrList<CObList,CStroke*>     m_strokeList;   
  36.     CPen*           GetCurrentPen() { return &m_penCur; }
  37.  
  38. // Operations
  39. public:
  40.     CStroke* NewStroke();
  41.  
  42. // Overrides
  43.     // ClassWizard generated virtual function overrides
  44.     //{{AFX_VIRTUAL(CScribbleDoc)
  45.     public:
  46.     virtual BOOL OnNewDocument();
  47.     virtual void Serialize(CArchive& ar);
  48.     virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
  49.     virtual void DeleteContents();
  50.     //}}AFX_VIRTUAL
  51.  
  52. // Implementation
  53. public:
  54.     virtual ~CScribbleDoc();
  55. #ifdef _DEBUG
  56.     virtual void AssertValid() const;
  57.     virtual void Dump(CDumpContext& dc) const;
  58. #endif
  59.  
  60. protected:
  61.     void            InitDocument();
  62.  
  63. // Generated message map functions
  64. protected:
  65.     //{{AFX_MSG(CScribbleDoc)
  66.         // NOTE - the ClassWizard will add and remove member functions here.
  67.         //    DO NOT EDIT what you see in these blocks of generated code !
  68.     //}}AFX_MSG
  69.     DECLARE_MESSAGE_MAP()
  70. };
  71.  
  72. /////////////////////////////////////////////////////////////////////////////
  73. // class CStroke
  74. //
  75. // A stroke is a series of connected points in the scribble drawing.
  76. // A scribble document may have multiple strokes.
  77.  
  78. class CStroke : public CObject
  79. {
  80. public:
  81.     CStroke(UINT nPenWidth);
  82.  
  83. protected:
  84.     CStroke();
  85.     DECLARE_SERIAL(CStroke)
  86.  
  87. // Attributes
  88. protected:
  89.     UINT                   m_nPenWidth;    // one pen width applies to entire stroke
  90. public:
  91.     CArray<CPoint,CPoint>  m_pointArray;   // series of connected points
  92.  
  93. // Operations
  94. public:
  95.     BOOL DrawStroke(CDC* pDC);
  96.  
  97. public:
  98.     virtual void Serialize(CArchive& ar);
  99. };
  100.